package com.gxa.controller;

import com.gxa.pojo.Member;
import com.gxa.utils.Constants;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/26 18:17
 * Description:
 * Version: V1.0
 */
@RestController
@Api(value = "测试会员",tags = "测试会员")
@RequestMapping(value = "options")
public class TestMemberController {

    @Autowired
    private ResponseData responseData;
    @Autowired(required = false)
    private Constants constants;


    @GetMapping("/updateTestMember")
    @ApiOperation(value = "会员修改测试会员",notes = "根据提交的信息会员修改测试会员",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "修改成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "修改失败")
    })
    public ResponseData updateTestMember(@ApiParam(name = "mpId",value = "测试会员",required = true) int memberId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("修改成功");
        responseData.setData(memberId);
        return responseData;
    }





    @PostMapping("/queryTestMemberByKeyword")
    @ApiOperation(value = "关键字查询会员",notes = "关键字查询会员",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryTestMemberByKeyword(@ApiParam(name = "mp",value = "关键字查询会员",required = true) Member member){
        responseData.setMsg("查询成功");
        responseData.setData(member);
        return responseData;
    }


    @PostMapping("/queryTestMember")
    @ApiOperation(value = "查询会员",notes = "根据提交的信息查询会员",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryTestMember(@ApiParam(name = "member",value = "会员",required = true) Member member){
        member.setMemberName("张三");
        member.setMemberPhone("12345678901");
        responseData.setMsg("查询成功");
        responseData.setData(member);
        return responseData;
    }
}
